import gui.Constants;
import gui.EarthPanel;
import gui.UserControlPanel;

import javax.swing.*;

import java.awt.*;

public class EarthSim extends JFrame {
  private static final long serialVersionUID = 3386230071400230901L;
  private Container contentPane = getContentPane();

	/** Creates a new instance of GUIPlate */
	public EarthSim() {
		super("Earth Heat Simulation");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setSize(new Dimension(Constants.FRAME_WIDTH, Constants.FRAME_HEIGHT));
    setLocation(0, 200);
	}

	private void createAndShowGUI() {
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (Exception ex) {
			ex.printStackTrace();
		}
    
		//create and add widgets
		JPanel pnlMain = new JPanel();
    pnlMain.setLayout(new BoxLayout(pnlMain, BoxLayout.PAGE_AXIS));
    
    EarthPanel pnlEarth = new EarthPanel();
//    pnlEarth.setAlignmentX(Component.CENTER_ALIGNMENT);
        
    UserControlPanel pnlControls = new UserControlPanel(pnlEarth);
    pnlControls.setAlignmentX(Component.LEFT_ALIGNMENT);
    
//    pnlMain.add(pnlControls);
//    pnlMain.add(pnlEarth);    
//    contentPane.add(pnlMain);
    
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS));
    contentPane.add(pnlControls);
    contentPane.add(pnlEarth);
    
//    pnlMain.add(pnlControls);
//    pnlMain.add(pnlEarth); 
//    contentPane.setLayout(new BorderLayout());
//    contentPane.add(Box.createHorizontalStrut(30), BorderLayout.EAST);
//    contentPane.add(Box.createRigidArea(new Dimension(50,50)), BorderLayout.WEST);
//    contentPane.add(pnlMain, BorderLayout.CENTER);
    
//    contentPane.setLayout(new BorderLayout());
////  contentPane.add(Box.createHorizontalStrut(30), BorderLayout.EAST);
////  contentPane.add(Box.createRigidArea(new Dimension(50,50)), BorderLayout.WEST);
//    contentPane.add(pnlEarth, BorderLayout.CENTER);
//    contentPane.add(pnlControls, BorderLayout.NORTH);
		setVisible(true);
	}

	/**
	 * @param args the command line arguments
	 */
	public static void main(String[] args) {
		javax.swing.SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				new EarthSim().createAndShowGUI();
			}
		});
	}
}
